﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="ReturnCar.aspx.cs" Inherits="Employee_Rent_ReturnCar" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    <style type="text/css">
        .style1
        {
            width: 44%;
        }
        .style2
        {
        }
        .style3
        {}
        .style4
        {
            width: 43%;
        }
        .style5
        {
            width:188px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <table class="style1">
        <tr>
            <td class="style2">
                Search by:<asp:DropDownList ID="DropDownList1" runat="server" style="margin-left: 4px">
                    <asp:ListItem>License Number</asp:ListItem>
                    <asp:ListItem>Plate Number</asp:ListItem>
                    <asp:ListItem>Booking Number</asp:ListItem>
                </asp:DropDownList>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:Button ID="go" runat="server" onclick="go_Click" Text="Go" />
            </td>
        </tr>
    </table>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        DataKeyNames="booking_id,plate_no" DataSourceID="SqlDataSource1" 
        EnableModelValidation="True" AllowPaging="True" AllowSorting="True" 
        CellPadding="4" ForeColor="Black" GridLines="Vertical" 
        onselectedindexchanged="GridView1_SelectedIndexChanged" BackColor="White" 
        BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:CommandField ShowSelectButton="True" ButtonType="Button" />
            <asp:BoundField DataField="booking_id" HeaderText="Booking ID" ReadOnly="True" 
                SortExpression="booking_id" />
            <asp:BoundField DataField="car_id" HeaderText="Car ID" 
                SortExpression="car_id" />
            <asp:BoundField DataField="license_no" HeaderText="License No" 
                SortExpression="license_no" />
            <asp:BoundField DataField="plate_no" HeaderText="Plate No" ReadOnly="True" 
                SortExpression="plate_no" />
          <asp:TemplateField HeaderText="Start Date" SortExpression="birth_date">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("start_date", "{0:yyyy/MM/dd}") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            <asp:TemplateField HeaderText="Return Date" SortExpression="birth_date">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("return_date", "{0:yyyy/MM/dd}") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            <asp:BoundField DataField="tariff" HeaderText="Tariff" 
                SortExpression="tariff" />
            <asp:BoundField DataField="type" HeaderText="Insurance Type" SortExpression="type" />
            <asp:BoundField DataField="cost" HeaderText="Insurance Cost" SortExpression="cost" />
            <asp:BoundField DataField="total_amout" HeaderText="Total" 
                SortExpression="total_amout" />
        </Columns>
        <FooterStyle BackColor="#CCCC99" />
        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
        <RowStyle BackColor="#F7F7DE" />
        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:MySqlConnectionString %>" 
        ProviderName="<%$ ConnectionStrings:MySqlConnectionString.ProviderName %>" 
        
        SelectCommand="SELECT booking.booking_id, booking.car_id, booking.license_no, car.plate_no, booking.start_date, booking.return_date, car.tariff, insurance.type, insurance.cost, booking.total_amout FROM booking INNER JOIN insurance ON booking.insurance_id = insurance.insurance_id INNER JOIN car ON booking.car_id = car.car_id where booking.status=1">
    </asp:SqlDataSource>
    <table class="style4">
        <tr>
            <td class="style5" align="right">
                <asp:Button ID="Button2" runat="server" Text="Return" onclick="Button2_Click" />
            </td>
                <td>
                    <asp:Button ID="Button3" runat="server" Text="Close" />
                </td>
        </tr>
    </table>
</asp:Content>

